package io.gitee.chearnee.fw.datasecurity.core.annotation.desensitization;

import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;

/**
 * 通用脱敏
 *
 * @author cn
 * @version 1.0
 * @description
 * @date 11/9/2022 3:27 PM
 * <p>
 * <table border cellspacing="8">
 * <caption>Examples(18380802097)</caption>
 * <tr><th>firstShow</th><th>lastShow</th><th>eg</th>
 * <tr><td >{@code -1}</td> <td>{@code -1}</td><td>{@code 18380802097}</td>
 * <tr><td>{@code -1}</td> <td>{@code 0}</td><td>{@code ***********}</td>
 * <tr><td>{@code -1}</td> <td>{@code 4}</td><td>{@code *******2097}</td>
 * <tr><td>{@code 0}</td> <td>{@code -1}</td><td>{@code ***********}</td>
 * <tr><td>{@code 0}</td> <td>{@code 0}</td><td>{@code ***********}</td>
 * <tr><td>{@code 0}</td> <td>{@code 4}</td><td>{@code *******2097}</td>
 * <tr><td>{@code 3}</td> <td>{@code -1}</td><td>{@code 183********}</td>
 * <tr><td>{@code 3}</td> <td>{@code 0}</td><td>{@code 183********}</td>
 * <tr><td>{@code 3}</td> <td>{@code 4}</td><td>{@code 183****2097}</td>
 * </table>
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.PARAMETER})
public @interface SDGeneralField {
    /**
     * 前几位显示
     */
    @AliasFor("value")
    int firstShow() default 1;

    /**
     * 后几位显示
     */
    int lastShow() default -1;

    /**
     * 掩码标识
     */
    char mask() default '*';

    /**
     * 前几位显示
     */
    @AliasFor("firstShow")
    int value() default 1;
}
